1 Transects

Plant Flowers Date lon lat ele Month Year julian
Glossoloma oblongicalyx 4 2015-10-19 -78.59093 0.130838 2270 October 2015 292
Gasteranthus quitensis 2 2016-10-17 -78.59770 0.120070 1940 October 2016 291
Kohleria affinis 1 2016-12-13 -78.59534 0.126746 2110 December 2016 348
Columnea ciliata 3 2014-02-27 -78.59934 0.116682 1960 February 2014 58
Columnea medicinalis 1 2014-04-23 -78.59372 0.128700 2130 April 2014 113
Drymonia teuscheri 3 2016-07-28 -78.59245 0.129393 2200 July 2016 210

2 Interactions

3 Phylogeny

4 Traits

Plant Flowers Date lon lat ele Month Year julian
Glossoloma oblongicalyx 4 2015-10-19 -78.59093 0.130838 2270 October 2015 292
Gasteranthus quitensis 2 2016-10-17 -78.59770 0.120070 1940 October 2016 291
Kohleria affinis 1 2016-12-13 -78.59534 0.126746 2110 December 2016 348
Columnea ciliata 3 2014-02-27 -78.59934 0.116682 1960 February 2014 58
Columnea medicinalis 1 2014-04-23 -78.59372 0.128700 2130 April 2014 113
Drymonia teuscheri 3 2016-07-28 -78.59245 0.129393 2200 July 2016 210

4.0.1 Total Flowers

4.1 Peak date

As range

4.2 Infer absences

4.3 Species elevation ranges

4.4 Flowering Data Matrix

4.5 Species by transect matrix

## sink("model/threshold_baseline.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
## 
##     #Observation of a flowering plant
##     Y[x] ~ dbern(p[x])
##     logit(p[x]) <- alpha[Plant[x]] 
##     
##     #Residuals
##     discrepancy[x] <- abs(Y[x] - p[x])
##     
##     #Assess Model Fit
##     Ynew[x] ~ dbern(p[x])
##     discrepancy.new[x]<-abs(Ynew[x] - p[x])
##     }
##     
##     
##     #Sum discrepancy
##     fit<-sum(discrepancy)/Nobs
##     fitnew<-sum(discrepancy.new)/Nobs
##     
##     #Prediction
##     
##     for(x in 1:Npreds){
##     #predict value
##     
##     #Observation - probability of flowering
##     prediction[x] ~ dbern(p_new[x])
##     logit(p_new[x])<-alpha[PredPlant[x]]
##     
##     #predictive error
##     pred_error[x] <- abs(Ypred[x] - prediction[x])
##     }
##     
##     
##     #Predictive Error
##     fitpred<-sum(pred_error)/Npreds
##     
##     #Priors
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##     
##     #Intercept
##     #Intercept flowering count
##     alpha[j] ~ dnorm(0,0.386)
##     
##     } 
## 
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 2324
##    Unobserved stochastic nodes: 2926
##    Total graph size: 14658
## 
## Initializing model

5 Get Chains

5.0.1 Evaluate convergence

5.0.2 Posterior estimates

6 Phylogeny

6.1 Attraction

## sink("model/threshold_attraction.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
##     
##     #Observation of a flowering plant
##     Y[x] ~ dbern(p[x])
##     logit(p[x]) <- alpha[Plant[x]] + e[Plant[x],Month[x]]
##     
##     #Residuals
##     discrepancy[x] <- abs(Y[x] - p[x])
##     
##     #Assess Model Fit
##     Ynew[x] ~ dbern(p[x])
##     discrepancy.new[x]<-abs(Ynew[x] - p[x])
##     }
##     
##     #Sum discrepancy
##     fit<-sum(discrepancy)/Nobs
##     fitnew<-sum(discrepancy.new)/Nobs
##     
##     #Prediction
##     
##     for(x in 1:Npreds){
##     #predict value
##     
##     #Observation - probability of flowering
##     prediction[x] ~ dbern(p_new[x])
##     logit(p_new[x])<-alpha[NewPlant[x]] + e[NewPlant[x],NewMonth[x]]
##     
##     #predictive error
##     pred_error[x] <- abs(Ypred[x] - prediction[x])
##     }
##     
##     #Predictive Error
##     fitpred<-sum(pred_error)/Npreds
##     
##     #########################
##     #autocorrelation in error
##     #########################
##     
##     #For each of observation
##     for(y in 1:Months){
##     e[1:Plants,y] ~ dmnorm(zeros,tauC[,])
##     }
##     
## 
##     ##covariance among similiar species
##     for(i in 1:Plants){
##     for(j in 1:Plants){
##     C[i,j] = exp(-lambda_cov * D[i,j])
##     }
##     }
##     
##     ## Covert variance to precision for each parameter, allow omega to shrink to identity matrix
##     vCov = omega*C[,] + (1-omega) * I
##     tauC=inverse(vCov*gamma)
##     
##     #Priors
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##     
##     #Intercept
##     #Intercept flowering count
##     alpha[j] ~ dnorm(0,0.386)
##     
##     } 
##     
##     #Autocorrelation priors
##     gamma = 1
##     
##     #Strength of covariance decay
##     lambda_cov ~ dunif(0,5)
##     omega = 1
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 2324
##    Unobserved stochastic nodes: 2939
##    Total graph size: 19058
## 
## Initializing model

7 Get Chains

7.0.1 Evaluate convergence

7.0.2 Posterior estimates

Mean phylogenetic covariance

7.1 Decay in phylogenetic attraction

7.2 Repulsion

## sink("model/threshold_repulsion.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
##     
##     #Observation of a flowering plant
##     Y[x] ~ dbern(p[x])
##     logit(p[x]) <- alpha[Plant[x]] + e[Plant[x],Month[x]]
##     
##     #Residuals
##     discrepancy[x] <- abs(Y[x] - p[x])
##     
##     #Assess Model Fit
##     Ynew[x] ~ dbern(p[x])
##     discrepancy.new[x]<-abs(Ynew[x] - p[x])
##     }
##     
##     
##     #Sum discrepancy
##     fit<-sum(discrepancy)/Nobs
##     fitnew<-sum(discrepancy.new)/Nobs
##     
##     #Prediction
##     
##     for(x in 1:Npreds){
##     #predict value
##     
##     #Observation - probability of flowering
##     prediction[x] ~ dbern(p_new[x])
##     logit(p_new[x])<-alpha[NewPlant[x]] + e[NewPlant[x],NewMonth[x]]
##     
##     #predictive error
##     pred_error[x] <- abs(Ypred[x] - prediction[x])
##     }
##     
##     #Predictive Error
##     fitpred<-sum(pred_error)/Npreds
##     
##     #########################
##     #autocorrelation in error
##     #########################
##     
##     #For each of observation
##     for(y in 1:Months){
##     e[1:Plants,y] ~ dmnorm(zeros,tauC[,])
##     }
##     
##     ##covariance among similiar species
##     for(i in 1:Plants){
##     for(j in 1:Plants){
##     C[i,j] = exp(-lambda_cov * D[i,j])
##     }
##     }
##     
##     ## Covert variance to precision for each parameter, allow omega to shrink to identity matrix
##     vCov = omega*C[,] + (1-omega) * I
##     tauC=vCov*gamma
##     
##     #Priors
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##     
##     #Intercept
##     #Intercept flowering count
##     alpha[j] ~ dnorm(0,0.386)
##     
##     } 
##     
##     #Autocorrelation priors
##     gamma = 1
##     
##     #Strength of covariance decay
##     lambda_cov ~ dunif(0,5)
##     omega = 1
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 2324
##    Unobserved stochastic nodes: 2939
##    Total graph size: 19057
## 
## Initializing model

8 Get Chains

8.0.1 Evaluate convergence

8.0.2 Posterior estimates

Mean phylogenetic covariance martix

8.1 Decay in phylogenetic repulsion

9 Traits

9.1 Trait Attraction

## sink("model/threshold_attraction.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
##     
##     #Observation of a flowering plant
##     Y[x] ~ dbern(p[x])
##     logit(p[x]) <- alpha[Plant[x]] + e[Plant[x],Month[x]]
##     
##     #Residuals
##     discrepancy[x] <- abs(Y[x] - p[x])
##     
##     #Assess Model Fit
##     Ynew[x] ~ dbern(p[x])
##     discrepancy.new[x]<-abs(Ynew[x] - p[x])
##     }
##     
##     #Sum discrepancy
##     fit<-sum(discrepancy)/Nobs
##     fitnew<-sum(discrepancy.new)/Nobs
##     
##     #Prediction
##     
##     for(x in 1:Npreds){
##     #predict value
##     
##     #Observation - probability of flowering
##     prediction[x] ~ dbern(p_new[x])
##     logit(p_new[x])<-alpha[NewPlant[x]] + e[NewPlant[x],NewMonth[x]]
##     
##     #predictive error
##     pred_error[x] <- abs(Ypred[x] - prediction[x])
##     }
##     
##     #Predictive Error
##     fitpred<-sum(pred_error)/Npreds
##     
##     #########################
##     #autocorrelation in error
##     #########################
##     
##     #For each of observation
##     for(y in 1:Months){
##     e[1:Plants,y] ~ dmnorm(zeros,tauC[,])
##     }
##     
## 
##     ##covariance among similiar species
##     for(i in 1:Plants){
##     for(j in 1:Plants){
##     C[i,j] = exp(-lambda_cov * D[i,j])
##     }
##     }
##     
##     ## Covert variance to precision for each parameter, allow omega to shrink to identity matrix
##     vCov = omega*C[,] + (1-omega) * I
##     tauC=inverse(vCov*gamma)
##     
##     #Priors
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##     
##     #Intercept
##     #Intercept flowering count
##     alpha[j] ~ dnorm(0,0.386)
##     
##     } 
##     
##     #Autocorrelation priors
##     gamma = 1
##     
##     #Strength of covariance decay
##     lambda_cov ~ dunif(0,5)
##     omega = 1
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 2324
##    Unobserved stochastic nodes: 2939
##    Total graph size: 19214
## 
## Initializing model

10 Get Chains

10.0.1 Evaluate convergence

10.0.2 Posterior estimates

10.1 Decay in trait attraction

10.2 Repulsion

## sink("model/threshold_repulsion.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
##     
##     #Observation of a flowering plant
##     Y[x] ~ dbern(p[x])
##     logit(p[x]) <- alpha[Plant[x]] + e[Plant[x],Month[x]]
##     
##     #Residuals
##     discrepancy[x] <- abs(Y[x] - p[x])
##     
##     #Assess Model Fit
##     Ynew[x] ~ dbern(p[x])
##     discrepancy.new[x]<-abs(Ynew[x] - p[x])
##     }
##     
##     
##     #Sum discrepancy
##     fit<-sum(discrepancy)/Nobs
##     fitnew<-sum(discrepancy.new)/Nobs
##     
##     #Prediction
##     
##     for(x in 1:Npreds){
##     #predict value
##     
##     #Observation - probability of flowering
##     prediction[x] ~ dbern(p_new[x])
##     logit(p_new[x])<-alpha[NewPlant[x]] + e[NewPlant[x],NewMonth[x]]
##     
##     #predictive error
##     pred_error[x] <- abs(Ypred[x] - prediction[x])
##     }
##     
##     #Predictive Error
##     fitpred<-sum(pred_error)/Npreds
##     
##     #########################
##     #autocorrelation in error
##     #########################
##     
##     #For each of observation
##     for(y in 1:Months){
##     e[1:Plants,y] ~ dmnorm(zeros,tauC[,])
##     }
##     
##     ##covariance among similiar species
##     for(i in 1:Plants){
##     for(j in 1:Plants){
##     C[i,j] = exp(-lambda_cov * D[i,j])
##     }
##     }
##     
##     ## Covert variance to precision for each parameter, allow omega to shrink to identity matrix
##     vCov = omega*C[,] + (1-omega) * I
##     tauC=vCov*gamma
##     
##     #Priors
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##     
##     #Intercept
##     #Intercept flowering count
##     alpha[j] ~ dnorm(0,0.386)
##     
##     } 
##     
##     #Autocorrelation priors
##     gamma = 1
##     
##     #Strength of covariance decay
##     lambda_cov ~ dunif(0,5)
##     omega = 1
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 2324
##    Unobserved stochastic nodes: 2939
##    Total graph size: 19213
## 
## Initializing model

11 Get Chains

11.0.1 Evaluate convergence

11.0.2 Posterior estimates

11.1 Decay in trait repulsion

12 Interaction

12.1 Attraction

## sink("model/threshold_attraction.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
##     
##     #Observation of a flowering plant
##     Y[x] ~ dbern(p[x])
##     logit(p[x]) <- alpha[Plant[x]] + e[Plant[x],Month[x]]
##     
##     #Residuals
##     discrepancy[x] <- abs(Y[x] - p[x])
##     
##     #Assess Model Fit
##     Ynew[x] ~ dbern(p[x])
##     discrepancy.new[x]<-abs(Ynew[x] - p[x])
##     }
##     
##     #Sum discrepancy
##     fit<-sum(discrepancy)/Nobs
##     fitnew<-sum(discrepancy.new)/Nobs
##     
##     #Prediction
##     
##     for(x in 1:Npreds){
##     #predict value
##     
##     #Observation - probability of flowering
##     prediction[x] ~ dbern(p_new[x])
##     logit(p_new[x])<-alpha[NewPlant[x]] + e[NewPlant[x],NewMonth[x]]
##     
##     #predictive error
##     pred_error[x] <- abs(Ypred[x] - prediction[x])
##     }
##     
##     #Predictive Error
##     fitpred<-sum(pred_error)/Npreds
##     
##     #########################
##     #autocorrelation in error
##     #########################
##     
##     #For each of observation
##     for(y in 1:Months){
##     e[1:Plants,y] ~ dmnorm(zeros,tauC[,])
##     }
##     
## 
##     ##covariance among similiar species
##     for(i in 1:Plants){
##     for(j in 1:Plants){
##     C[i,j] = exp(-lambda_cov * D[i,j])
##     }
##     }
##     
##     ## Covert variance to precision for each parameter, allow omega to shrink to identity matrix
##     vCov = omega*C[,] + (1-omega) * I
##     tauC=inverse(vCov*gamma)
##     
##     #Priors
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##     
##     #Intercept
##     #Intercept flowering count
##     alpha[j] ~ dnorm(0,0.386)
##     
##     } 
##     
##     #Autocorrelation priors
##     gamma = 1
##     
##     #Strength of covariance decay
##     lambda_cov ~ dunif(0,5)
##     omega = 1
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 2324
##    Unobserved stochastic nodes: 2939
##    Total graph size: 19214
## 
## Initializing model

12.1.1 Evaluate convergence

12.1.2 Posterior estimates

Mean interaction covariance

12.2 Decay in interaction attraction

12.3 Repulsion

## sink("model/threshold_repulsion.jags")
## cat("
##     model {
##     
##     for (x in 1:Nobs){
##     
##     #Observation of a flowering plant
##     Y[x] ~ dbern(p[x])
##     logit(p[x]) <- alpha[Plant[x]] + e[Plant[x],Month[x]]
##     
##     #Residuals
##     discrepancy[x] <- abs(Y[x] - p[x])
##     
##     #Assess Model Fit
##     Ynew[x] ~ dbern(p[x])
##     discrepancy.new[x]<-abs(Ynew[x] - p[x])
##     }
##     
##     
##     #Sum discrepancy
##     fit<-sum(discrepancy)/Nobs
##     fitnew<-sum(discrepancy.new)/Nobs
##     
##     #Prediction
##     
##     for(x in 1:Npreds){
##     #predict value
##     
##     #Observation - probability of flowering
##     prediction[x] ~ dbern(p_new[x])
##     logit(p_new[x])<-alpha[NewPlant[x]] + e[NewPlant[x],NewMonth[x]]
##     
##     #predictive error
##     pred_error[x] <- abs(Ypred[x] - prediction[x])
##     }
##     
##     #Predictive Error
##     fitpred<-sum(pred_error)/Npreds
##     
##     #########################
##     #autocorrelation in error
##     #########################
##     
##     #For each of observation
##     for(y in 1:Months){
##     e[1:Plants,y] ~ dmnorm(zeros,tauC[,])
##     }
##     
##     ##covariance among similiar species
##     for(i in 1:Plants){
##     for(j in 1:Plants){
##     C[i,j] = exp(-lambda_cov * D[i,j])
##     }
##     }
##     
##     ## Covert variance to precision for each parameter, allow omega to shrink to identity matrix
##     vCov = omega*C[,] + (1-omega) * I
##     tauC=vCov*gamma
##     
##     #Priors
##     
##     #Species level priors
##     
##     for (j in 1:Plants){
##     
##     #Intercept
##     #Intercept flowering count
##     alpha[j] ~ dnorm(0,0.386)
##     
##     } 
##     
##     #Autocorrelation priors
##     gamma = 1
##     
##     #Strength of covariance decay
##     lambda_cov ~ dunif(0,5)
##     omega = 1
##     }
##     ",fill=TRUE)
## 
## sink()
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 2324
##    Unobserved stochastic nodes: 2939
##    Total graph size: 19213
## 
## Initializing model

13 Get Chains

13.0.1 Evaluate convergence

13.0.2 Posterior estimates

Mean interaction covariance martix

13.1 Decay in interaction repulsion

14 Model Comparison

14.1 E: The effect of autocorrelation on mean flowering occurrence

14.1.1 E: The effect of autocorrelation

Dig into one example.

Glossoloma purpureum

15 By site

15.1 1300m - 1500m

15.2 1500-1700m

15.3 1700-1900

15.4 1900-2100m

15.5 2100-2300m

15.6 2300m - 2500m

15.7 Alpha: Species occurrence probability

15.8 Omega: The magnitude of the effect of autocorrelation on mean flowering occurrence

15.9 Gamma: The variance of the effect of autocorrelation on mean flowering occurrence

15.10 Lambda: The decay in autocorrelation effect

15.11 Decay in autocorrelation effect

16 Model Fit

16.1 Bayesian pvalue

## # A tibble: 7 x 2
##   Model                       p
##   <chr>                   <dbl>
## 1 baseline                0.566
## 2 interaction_attraction  0.516
## 3 interaction_repulsion   0.424
## 4 phylogenetic_attraction 0.546
## 5 phylogenetic_repulsion  0.398
## 6 trait_attraction        0.512
## 7 trait_repulsion         0.348

Without baseline

## # A tibble: 6 x 2
##   Model                       p
##   <chr>                   <dbl>
## 1 interaction_attraction  0.516
## 2 interaction_repulsion   0.424
## 3 phylogenetic_attraction 0.546
## 4 phylogenetic_repulsion  0.398
## 5 trait_attraction        0.512
## 6 trait_repulsion         0.348

16.2 Overall

Model mean lower upper
trait_attraction 0.2356662 0.2281782 0.2437443
phylogenetic_attraction 0.2340925 0.2269154 0.2417079
interaction_attraction 0.2334567 0.2269549 0.2408136
phylogenetic_repulsion 0.2316520 0.2244831 0.2384131
interaction_repulsion 0.2316189 0.2245073 0.2389730
trait_repulsion 0.2306153 0.2229083 0.2380396

16.2.1 Without baseline

16.3 By Species

Without baseline

Zoom in

17 Prediction

##  [1] Draw      chain     par       value     parameter jPlant    Plant    
##  [8] Index     Site      Month     Year      n         ele       Model    
## [15] Effect   
## <0 rows> (or 0-length row.names)

17.0.1 Tables

Model mean lower upper
baseline 0.2476531 0.2227891 0.2721088
phylogenetic_attraction 0.2351701 0.2091837 0.2602891
trait_attraction 0.2350952 0.2107993 0.2619048
phylogenetic_repulsion 0.2342041 0.2090986 0.2585034
trait_repulsion 0.2338741 0.2108844 0.2602041
interaction_attraction 0.2334796 0.2091837 0.2585884
interaction_repulsion 0.2323571 0.2108844 0.2568878